<template>
  <div class="container store-home">
    <div v-if="data">
      <div class="store-home-box">
        <div class="store">
          <div class="store-pic">
            <img :src="data.storeInfo.store_logo" alt="">
          </div>
          <div class="store-info">
            <div class="store-name">
              <div class="store-title">
                <p>{{data.storeInfo.store_name}}</p>
              </div>
            </div>
            <div class="store-rate">
              <i-rate count="5" size="16" :value="data.storeInfo.store_credit" disabled><span>{{data.storeInfo.store_credit}}.0</span></i-rate>
            </div>
          </div>
        </div>
        <div class="edit-store">编辑</div>
      </div>
      <div class="store-report">
        <div class="store-report-box">
          <span class="value">{{data.storeReport.todaySale}}</span>
          <span class="key">今日销售额</span>
        </div>
        <div class="store-report-box">
          <span class="value">{{data.storeReport.todayCount}}</span>
          <span class="key">今日订单数</span>
        </div>
        <div class="store-report-box">
          <span class="value">{{data.storeReport.historySale}}</span>
          <span class="key">历史销售额</span>
        </div>
        <div class="store-report-box">
          <span class="value">{{data.storeReport.yesterdaySale}}</span>
          <span class="key">昨日销售额</span>
        </div>
        <div class="store-report-box">
          <span class="value">{{data.storeReport.yesterdayCount}}</span>
          <span class="key">昨日订单数</span>
        </div>
        <div class="store-report-box">
          <span class="value">{{data.storeReport.historyCount}}</span>
          <span class="key">历史订单数</span>
        </div>
      </div>
      <div class="blank-spaces"></div>
      <div class="ant-panel">
        <div class="ant-panel-head" @click="$router.push({ path: '/pages/orderList/orderList',query:{type:'store'}})">
          <p class="ant-panel-title">待办事项</p>
        </div>
        <div class="ant-panel-body">
          <div class="ant-grid-list">
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/orderList/orderList',query:{status:1,type:'store'}})">
              <i-badge :count="data.storeOrderCount.unpayCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-daifukuan.png" />
                <p class="ant-grid-text">待付款</p>
              </i-badge>
            </div>
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/orderList/orderList',query:{status:2,type:'store'}})">
              <i-badge :count="data.storeOrderCount.undeliverCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-daifahuo.png" />
                <p class="ant-grid-text">待发货</p>
              </i-badge>
            </div>
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/orderList/orderList',query:{status:3,type:'store'}})">
              <i-badge :count="data.storeOrderCount.deliveringCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-faishouhuo.png" />
                <p class="ant-grid-text">待收货</p>
              </i-badge>
            </div>
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/orderList/orderList',query:{status:4,type:'store'}})">
              <i-badge :count="data.storeOrderCount.unevalCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-daipingjia.png" />
                <p class="ant-grid-text">待评价</p>
              </i-badge>
            </div>
            <i-badge :count="data.storeOrderCount.returnCount">
              <div class="ant-grid-item" @click="$router.push({ path: '/pages/exchange/exchange'})">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/iocn-tuihuanhuo.png" />
                <p class="ant-grid-text">退换货</p>
              </div>
            </i-badge>
          </div>
        </div>
      </div>
      <div class="blank-spaces"></div>
      <div class="ant-panel">
        <div class="ant-panel-head">
          <p class="ant-panel-title">我的管理</p>
        </div>
        <div class="ant-panel-body">
          <div class="ant-grid-list">
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/orderList/orderList',query:{status:1}})">
              <i-badge :count="data.storeOrderCount.unpayCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-zengjiafenlei.png" />
                <p class="ant-grid-text">增加分类</p>
              </i-badge>
            </div>
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/releaseGoods/releaseGoods'})">
              <i-badge :count="data.storeOrderCount.undeliverCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-daifahuo.png" />
                <p class="ant-grid-text">发布宝贝</p>
              </i-badge>
            </div>
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/setCoupons/setCoupons'})">
              <i-badge :count="data.storeOrderCount.deliveringCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-shezhiyouhuiquan.png" />
                <p class="ant-grid-text">设置优惠券</p>
              </i-badge>
            </div>
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/orderList/orderList'})">
              <i-badge :count="data.storeOrderCount.unevalCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-quanbubaobei.png" />
                <p class="ant-grid-text">全部宝贝</p>
              </i-badge>
            </div>
          </div>
        </div>
      </div>
      <div class="blank-spaces"></div>
      <div class="ant-panel">
        <div class="ant-panel-head">
          <p class="ant-panel-title">其他</p>
        </div>
        <div class="ant-panel-body">
          <div class="ant-grid-list">
            <div class="ant-grid-item" @click="$router.push({ path: '/pages/orderList/orderList'})">
              <i-badge :count="data.storeOrderCount.unpayCount">
                <img mode="widthFix" class="ant-grid-icon" src="../../../static/images/icon-tuiguang.png" />
                <p class="ant-grid-text">增加分类</p>
              </i-badge>
            </div>
            <div class="ant-grid-item"></div>
            <div class="ant-grid-item"></div>
            <div class="ant-grid-item"></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
  import {
    mapState,
    mapMutations
  } from "Vuex";
  // 依赖
  const {
    $Toast
  } = require('@/../static/iview/base/index');
  import request from "@/api/request";
  export default {
    components: {},
    data() {
      return {
        data: null
      };
    },
    computed: {
      ...mapState([])
    },
    methods: {
      ...mapMutations([]),
      getStoreSeller() {
        request.getStoreSeller().then(res => {
          console.log(res)
          this.data = res.data
        })
      }
    },
    mounted() {
      this.getStoreSeller()
    }
  };

</script>

<style lang="less">
  .add-address {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 49px;
    background: #fff;
    line-height: 49px;
    font-size: 15px;
    color: rgba(238, 117, 89, 1);
    text-align: center;

    &:after {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      width: 200%;
      height: 200%;
      transform: scale(0.5);
      transform-origin: 0 0;
      pointer-events: none;
      box-sizing: border-box;
      border: 0 solid #e9eaec;
      border-top-width: 1px;
    }
  }

  .store-home-box {
    height: 100px;
    background: url("../../../static/images/s-store-bg.png") #E54C28 no-repeat bottom;
    background-size: 100% auto;
    display: flex;
    padding: 0 15px;
    align-items: center;

    .store {
      background: none;

      .store-pic {
        border-radius: 50%;
        overflow: hidden;
        width: 50px;
        height: 50px;

        img {
          width: 50px;
          height: 50px;
        }
      }

      .store-info {}

      .store-name {
        color: #fff;
      }

      .store-title {
        color: #fff;
        margin-top: 5px;
      }

      .store-rate {
        color: #FF9F37;

        span {
          color: #fff;
        }
      }
    }

    .edit-store {
      color: #F9A693;
      font-size: 12px;
      white-space: nowrap;
      padding: 5px 15px;
    }
  }

  .store-report {
    display: flex;
    flex-wrap: wrap;
    background: #fff;

    .store-report-box {
      flex: 0 33.333333%;
      width: 33.333333%;
      padding: 12px 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      position: relative;
      border-right: 1rpx solid #F7F7F7;
      border-bottom: 1rpx solid #F7F7F7;

      &:nth-child(3n) {
        border-right: 0;
      }

      .value {
        margin-top: 8px;
        font-size: 18px;
        color: #606060;
        line-height: 1em;
        font-weight: bold;
        margin-bottom: 10px;
      }

      .key {
        font-size: 11px;
        color: #A0A0A0;
        line-height: 1em;
      }
    }
  }

</style>
